﻿<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
<%@ include file="../include/top.jsp"%>
<%@ include file="../include/errorArea.jsp"%>
<%@ include file="../include/message-save.jsp" %>
<script type="text/javascript">
	function saveReply(){
		$("#replyInputForm").submit();
	}
	
	function cudcasd(){
		alert("aaa");
	}

	
	
	function passwordCheck(){
		var community = $("#community").val();
		var buildNo = $("#buildNo").val();
		var unitNo = $("#unitNo").val();
		var roomNo = $("#roomNo").val();
		var realName = $("#realName").val();
		
		if(community == null || community == ''){
			alert("请选择小区");
			return false;
		}
		if(buildNo == null || buildNo == ''){
			alert("请选择楼号");
			return false;
		}
		if(unitNo == null || unitNo == ''){
			alert("请选择单元号");
			return false;
		}
		if(roomNo == null || roomNo == ''){
			alert("请选择门牌号");
			return false;
		}
		if(realName == null || realName == ''){
			alert("请填写会员名");
			return false;
		}
		//alert(community + "|" + buildNo + "|" + unitNo + "|" + roomNo + "|" + "realName");
		
		$.layer({
		    type: 2,
		    maxmin: true,
		    shadeClose: true,
		    title: '密码验证',
		    shade: [0.1,'#000000'],
		    shift:'top',
		    offset: ['10',''],
		    area: ['250px', '150px'],
		    iframe: {src: '${ctx}/companyAdmin/preAgentPasswordCheck/'+community+"/"+buildNo+"/"+unitNo+"/"+roomNo+"/"+realName}
		}); 
		
		
		/* $.post('${ctx}/companyAdmin/agentPasswordCheck/'+community+"/"+buildNo+"/"+unitNo+"/"+roomNo+"/"+realName,function(data, textStatus) {
			if(textStatus == 'success') {
				$("#companyName").val(data);
			}
		},"json");  */
	}
	
	function buttonSubmit(){
		document.getElementById("shopBuyForm").submit();
	}
</script>
</head>

<body>
	<form action="${baseURL}/companyAdmin/intoShopBuy" method="post" id="shopBuyForm" name="shopBuyForm" onsubmit="return selectUser();">
		<input type="hidden" name="id" value="${obj.id}"/>
		<input type="hidden" name="orderId" value="${obj.orderId}"/>
		<input type="hidden" name="productId" value="${obj.productId}"/>
		<input type="hidden" name="userId" value="${obj.userId}"/>
		<input type="hidden" name="score" value="${obj.score}"/>
<div class='adduser'>
	<div class='adduser-left'><div class='adduser-icon'></div><span>代下订单</span></div>
</div>
<div class='querycondition'>
	<div class='condtion'>
		<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1">
			 <tr>
   <td>
    	小区：<select name="community" id="community" style="width:100px" onchange="checkBuilding('${ctx}');">
    		<c:forEach var="com" items="${communityList}">
	      		<option value="${com.id}">${com.communityName}</option>
	      	</c:forEach>
    	</select>楼号：<select name="buildNo" id="buildNo" style="width:100px" onchange="checkUnit('${ctx}');">
    	<option value="">请选择</option>
    	<c:forEach var="build" items="${buildingList}">
	      		<option value="${build.id}">${build.buildingCode}</option>
	      	</c:forEach>
    	</select>单元号：
    	<select name="unitNo" id="unitNo" style="width:100px" onchange="checkRoom('${ctx}');"></select>
    	门牌号：<select name="roomNo" id="roomNo" style="width:100px" onchange="checkUser('${ctx}');"></select>
    	会员：<input type="text" id="realName" value="${formdata.realName}" name="realName" readonly="readonly" onclick="preCreateUser();"/>
   <input type="hidden" id="userNo" value="${formdata.userNo}" name="userNo" />
   <input type="button" style="display: none;" value="代下订单1" id="submitButton" class='button cyan medium' onclick="buttonSubmit();"/>
  
  <input type="button" value="代下订单" class='button cyan medium' onclick="passwordCheck();"/>
   </td>
   
  </tr>
		</table>
		</div>
		</div>
	</form>
	<script>
	function preCreateUser(){
		var user = document.getElementById("userNo").value;
		if(user!=null && user!="")
		$.layer({
		    type: 2,
		    maxmin: true,
		    shadeClose: true,
		    title: '会员详情',
		    shade: [0.1,'#fff'],
		    offset: [($(window).height() / 10)+'px',''],
		    area: ['600px', '400px'],
		    iframe: {src: '${ctx}/companyAdmin/showUser?uid='+user}
		}); 
	}
	
	</script>
<script src="${ctx}/js/buyProduct.js"></script>
</body>
</html>
  
